﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Web_Profile_Change_Password : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Change_Click(object sender, EventArgs e)
    {
        string uname = Session["user"].ToString();
        string pass = New_Password.Text;
        Bestlife.ERP.BusinessRules.B_Change_Password changepass = new Bestlife.ERP.BusinessRules.B_Change_Password();
        bool bb=changepass.updpass(uname, pass);
        if (bb) 
        {
            success.Text = "Password Changed Successfully";
        }
    }
    protected void Old_Password_TextChanged(object sender, EventArgs e)
    {
        Bestlife.ERP.Entities.E_Registration password = new Bestlife.ERP.Entities.E_Registration();
        string uname = Session["user"].ToString();
        string pass = Old_Password.Text;

        Bestlife.ERP.BusinessRules.B_Change_Password changepass = new Bestlife.ERP.BusinessRules.B_Change_Password();
        string result = changepass.uname(uname,pass);

        if (result.Equals("1"))
        {
            msg.Text = "Correct";
            Change.Visible = true;
            Change.Enabled = true;

        }
        else
        {
            msg.ForeColor = System.Drawing.Color.Red;
            msg.Text = "Incorrect Password";
            Change.Visible = false;
        }
    }
    protected void Cancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("Profile.aspx");
    }
}